<template>
  <div class="index">
    <van-nav-bar
      title="标题"
      left-text="返回"
      right-text="按钮"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <router-view/>
    <van-tabbar v-model="active" @change="onchange()">
      <van-tabbar-item icon="home-o" to='/home'>首页</van-tabbar-item>
      <van-tabbar-item icon="search" to='/search'>分类</van-tabbar-item>
      <van-tabbar-item icon="friends-o" to='/carts'>购物车</van-tabbar-item>
      <van-tabbar-item icon="setting-o" to='/my'>我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
// import Vant from 'vant'
// eslint-disable-next-line no-unused-vars
import { getSwiper } from '../api/index'
import { Toast } from 'vant'
export default {
  data () {
    return {
      active: 0
    }
  },
  created () {
    this.getLunbo()
  },
  methods: {
    async getLunbo () {
      const res = await getSwiper()
      console.log(res)
    },
    onClickLeft () {
      // Vant.Toast('返回')
      Toast('返回')
    },
    onClickRight () {
      // Vant.Toast('返回')
    },
    onchange () {
      console.log(this.active)
    }
  }
}
</script>

<style scoped lang='less'>

</style>
